from gevent import monkey
import gevent
import urllib.request  # 网络请求

monkey.patch_all()

def img_downloader(img_name,img_url):
    img = urllib.request.urlopen(img_url)
    img_content = img.read()
    with open(img_name,"wb") as f:
        f.write(img_content)
    

    
gevent.joinall([
    gevent.spawn(img_downloader,"1.jpg","https://img-baofun.zhhainiao.com/market/133/f43477adecc82e51dd1f5bd901c854c5_preview_raw.jpg"),
    gevent.spawn(img_downloader,"2.jpg","https://img-baofun.zhhainiao.com/market/133/508e9f36242b89776f9196a986af9bdb.mp4.jpg")
])